用Git下载代码得步骤
1.首先需要创建公钥,在命令行中输入:
1 | ssh-keygen -t rsa -C "ben@xxx.com" |
然后输入路径,密码之类的,如果不输入,工程就会保存到根目录下面,密码也为空。
1 | ~/.ssh/id_rsa是私钥,~/.ssh/id_rsa.pub是公钥 |
2.接着打开公钥:
1 | cat ~/.ssh/id_rsa.pub |
这里会得到一段很长的编码:
1 | ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCuYZIchz3THIcc/wH0ZB5WZYqe2iBVUNqSzfrgxBvJCZkFHWiUZhA/4omNud/27PVT/FADV9qSvrX7ifP05Cbl6mhE4uJjxOQRNoPdQQcsTEFh5vDvOeiJOT1CoFb9WLGg49Xml4yJmFJqv/Kz5hCe7LEWRYJH6tmaVG0qi9nwAZmjfTQpSWu07eAKB9wAbK6stCdnd5JvMq7IsNNylbwDlXf0RQA4RpppO+14oNBqivhi5ftBPjP15+aWKpnXUxkGMVAefKTvwsyw1T0H2sj+ILVFM4d5xpxu3jPHebqh363OwPPLMsoUy9VhQ3YDtMxt4vyOxvpJ9ekMGlDn/9ut linwenbang@yolanda.hk |
然后在进入GitLab或者Gitblit的个人中心,选择ssh key的配置,将新生成的ssh-key复制进去即可,配置完成之后即可克隆你想要克隆的项目了